home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / LONGNAME.C < prev    next >
Text File  |  1992-11-21  |  4KB  |  96 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #define        CURSES_LIBRARY  1
  4. #include <curses.h>
  5. #undef longname
  6.  
  7. #ifndef        NDEBUG
  8. char *rcsid_longname = "$Header: c:/curses/portable/RCS/longname.c%v 2.0 1992/11/15 03:28:59 MH Rel $";
  9. #endif
  10.  
  11.  
  12.  
  13.  
  14. #ifdef FLEXOS
  15. extern char*   _flexos_gname();
  16. #endif
  17.  
  18. static char    _display[ 128 ];
  19.  
  20.  
  21.  
  22.  
  23. /*man-start*********************************************************************
  24.  
  25.   longname()   - return full terminal type name
  26.  
  27.   X/Open Description:
  28.        This function returns a pointer to a static area containing a
  29.        verbose description of the current terminal.  The maximum length
  30.        of the string is 128 characters.  It is defined only after the
  31.        call to initscr() or newterm().  The area is overwritten by each
  32.        call to newterm() and is not restored by set_term().  The value
  33.        should therefore be saved between calls to newterm(), if
  34.        longname() is going to be used with multiple terminals.
  35.  
  36.   PDCurses Description:
  37.        In addition to the above definition, the form of this string is
  38.        the adapter name (or video card name) and the text resolution.
  39.        This may also be followed by the notation that the video card
  40.        may be a clone, which indicates that the card identification
  41.        maps to more than one unique card.
  42.  
  43.        e.g. The MDS Genius and the Quadram QuadHPG identify themselves
  44.        in the same manner, but are vastly different in maximum resolution.
  45.  
  46.   X/Open Return Value:
  47.        The longname() function returns a pointer to a verbose description
  48.        of the current terminal on success and the null pointer on error.
  49.  
  50.   X/Open Errors:
  51.        No errors are defined for this function.
  52.  
  53.   Portability:
  54.        PDCurses        char* longname( void );
  55.        X/Open Dec '88  char* longname( void );
  56.        BSD Curses      char* longname( void );
  57.        SYS V Curses    char* longname( void );
  58.  
  59. **man-end**********************************************************************/
  60.  
  61. char*  longname(void)
  62. {
  63. #ifdef     OS2
  64.        switch  (_cursvar.adapter.adapter)
  65.        {
  66.        case DISPLAY_CGA:       sprintf(_display, "CGA-%dx%d", LINES, COLS);      break;
  67.        case DISPLAY_MONOCHROME:        sprintf(_display, "MDA-%dx%d", LINES, COLS);      break;
  68.        case DISPLAY_EGA:       sprintf(_display, "EGA-%dx%d", LINES, COLS); break;
  69.        case DISPLAY_VGA:       sprintf(_display, "VGA-%dx%d", LINES, COLS); break;
  70.        case DISPLAY_8514A:     sprintf(_display, "8514-%dx%d", LINES, COLS);  break;
  71.        default:        sprintf(_display, "Unknown-%dx%d", LINES, COLS);  break;
  72.        }
  73. #else
  74.        switch  (_cursvar.adapter)
  75.        {
  76.        case _CGA:      sprintf(_display, "CGA-%dx%d", LINES, COLS);      break;
  77.        case _MDA:      sprintf(_display, "MDA-%dx%d", LINES, COLS);      break;
  78.        case _EGACOLOR: sprintf(_display, "EGAColor-%dx%d", LINES, COLS); break;
  79.        case _EGAMONO:  sprintf(_display, "EGAMono-%dx%d", LINES, COLS);  break;
  80.        case _VGACOLOR: sprintf(_display, "VGAColor-%dx%d", LINES, COLS); break;
  81.        case _VGAMONO:  sprintf(_display, "VGAMono-%dx%d", LINES, COLS);  break;
  82.        case _MCGACOLOR:sprintf(_display, "MCGAColor-%dx%d", LINES, COLS);break;
  83.        case _MCGAMONO: sprintf(_display, "MCGAMono-%dx%d", LINES, COLS); break;
  84.        case _MDS_GENIUS:sprintf(_display, "Genius-%dx%d", LINES, COLS);  break;
  85. #ifdef FLEXOS
  86.        case _FLEXOS:   sprintf(_display, "%s", _cursesgname());          break;
  87. #endif
  88.        default:        sprintf(_display, "Unknown-%dx%d", LINES, COLS);  break;
  89.        }
  90. #endif
  91.  
  92.        if (_cursvar.bogus_adapter)
  93.                strcat(_display, " (Clone)");
  94.        return (_display);
  95. }
  96.